#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int maxn = 1e5+10;
int Len[maxn];
char str[maxn];
char s[maxn];
struct node
{
	int l;
	int r;
}a[maxn];
bool cmp(node x,node y)
{
	return x.l<y.l;
}
int init()
{
	int len = strlen(s+1);
	int cnt = 1;
	for(int i = 1;i <= 2*len+1;i++)
	{
		if(i%2) str[i]='#';
		else str[i] = s[cnt++];
	}
	str[0]='&';
	str[2*len+2]='%';
	return 2*len+1;
}
void manacher(int len)
{
	int maxright = 0;
	int num = 0;
	for(int i=1;i<=len;i++)
	{
	//	cout<<i<<"*******"<<maxright<<endl;
		if(i<maxright)
		{
			//if(i==8) cout<<"******"<<endl;
			Len[i] = min(Len[2*num-i],maxright-i);
		}
		else Len[i] = 1;
		while(str[i+Len[i]]==str[i-Len[i]])
		{
			/*if(i==8)
			{
				cout<<str[i+Len[i]]<<"**"<<str[i-Len[i]]<<endl;
				cout<<"***"<<endl;
			}*/
			Len[i]++;
		}
		//printf("%c:Len[%d]=%d\n",str[i],i,Len[i]);
		if(maxright<i+Len[i])
		{
			maxright = i+Len[i];
			num = i;
		}
	//	cout<<i<<"***"<<Len[i]<<endl;
	}
}
int main()
{
	while(scanf("%s",s+1)!=EOF)
	{
		int cnt = 0;
		int len = init();
		manacher(len);
		for(int i = 1;i<=len;i++)
		{
		//	printf("%c:Len[%d]=%d\n",str[i],i,Len[i]);
		}
		for(int i = 1;i<=len;i++)
		{
			a[cnt].l = i-(Len[i]-1);
			a[cnt].r = i+(Len[i]-1);
		//	cout<<a[cnt].l<<"**"<<a[cnt].r<<endl;
			cnt++;
		}
		//cout<<cnt<<" "<<strlen(s+1)<<endl;
		sort(a,a+cnt,cmp);
		int r = 0;
		int ans = 0;
		int i = 0;
		while(i<cnt)
		{
			int sum = 0;
			while(a[i].l-1<=r&&i<cnt)
			{
				sum = max(sum,a[i].r);
				i++;
			}
			ans++;
			r = sum;
		//	cout<<sum<<endl;
			if(sum==cnt) break;
		}
		cout<<ans-1<<endl;
	}
} 
